package engler_jonas.part1;

import _untouchable_.TestAndEnvironment_A;

public class Testframe extends TestAndEnvironment_A{
	
	private static int numbofships = 1;
	private static int numbofsmurfs = 5;
	private static int numboflandings = 3;
	
	private  Landing landings[];
	
	public static void main(String[] args){
		Testframe tf = new Testframe();
		
		tf.letThereBeLife();
	}
	
	@Override
	public void doTest(int numberOfHarbors, int numberOfShips,
			int numberOfSmurfs) {
		landings = new Landing[numberOfHarbors];
		for(int i = 0; i < numberOfHarbors; i++){
			landings[i] = new Landing();
		}//for
		Ship ship = new Ship();
		Thread thread = new Thread(ship);
		ship.setTp(thread);
		thread.start();
		
		for(int i = 0; i< numberOfSmurfs; i++){		//Schlumpf-Thread(s) starten
			
			Smurf smurf = new Smurf();
			try {
				smurf.waitUntilNextArrival();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			smurf.setShip(ship);
			Thread threads = new Thread(smurf);
			smurf.setTp(threads);
			threads.start();
			ship.setSmurfspruefen(true);
		}//for
		
	
		
	}


	@Override
	public String getAuthorSurName() {
		return "Engler";
	}

	@Override
	public String getAuthorFirstName() {
		return "Jonas";
	}

	@Override
	public int getNumberOfShips() {
		return numbofships;
	}

	@Override
	public int getNumberOfSmurfs() {
		return numbofsmurfs;
	}

	@Override
	public int getNumberOfLandings() {
		return numboflandings;
	}

	
	
}
